* ********************************************************************************************
* The Effects of Weather Shocks on Economic Activity: What are the Channels of Impact?
* Sebastian Acevedo, Mico Mrkaic, Natalija Novta, Evgenia Pugacheva, Petia Topalova
* With support from Gavin Asdorian, Olivia Ma, Jilun Xing and Yuan Zeng 
* Replication files for Figure 2
* ********************************************************************************************
clear all
cd "C:\Users\..\replication" // set your working directory to where the replication folder is saved

use "data/temperature_precipitation.dta", clear

drop if year>2015

gen group = "AE" if ae == 1
replace group = "EM" if em == 1
replace group = "LIC" if lics == 1
drop if mi(group)

replace precip_CRU_pw50 = precip_CRU_pw50 * 100

collapse (median) tmp_CRU_pw50 precip_CRU_pw50, by(year group)
reshape wide tmp_CRU_pw50 precip_CRU_pw50, i(year) j(group) string

export excel using "output/Figure_2.xlsx", sheet("Stata") sheetreplace firstrow(var)
